﻿<c:WindowExt x:Class="personalplaner.gui.plugins.dienstplan.windows.CreateNewPlanView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             xmlns:bs="clr-namespace:personalplaner.business.stamm;assembly=personalplaner.business"
             xmlns:vm="clr-namespace:personalplaner.common.mvvm.factory;assembly=personalplaner.common"
             xmlns:conv="clr-namespace:personalplaner.common.converters;assembly=personalplaner.common"
             xmlns:fac="clr-namespace:personalplaner.gui.plugins.dienstplan.viewmodels.factories"
             vm:ViewModelLoader.FactoryType="{x:Type fac:CreateNewPlanModelFactory}"
             xmlns:c="clr-namespace:personalplaner.common.controls;assembly=personalplaner.common"
             xmlns:p="clr-namespace:personalplaner.gui.Properties" ShowInTaskbar="False"
             WindowStartupLocation="CenterOwner"
             Height="350" Width="550" Foreground="#E1000000">

    <Window.Background>
        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
            <LinearGradientBrush.GradientStops>
                <GradientStop Color="White" Offset="0"/>
                <GradientStop Color="White" Offset="0.6"/>
                <GradientStop Color="#FFEDEDED" Offset="1"/>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
    </Window.Background>
    
    <Control.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/personalplaner.common;component/resources/styles/WhiteStyleTemplates.xaml"/>
                <ResourceDictionary>
                    <DataTemplate DataType="{x:Type bs:PlanSchema}">
                        <Grid Margin="0,0,20,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="30"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Name="txtId" Text="{Binding ID}" Grid.Column="0" Margin="5,0,5,0"/>
                            <TextBlock Name="txtName" Text="{Binding Name}" Grid.Column="1"/>
                        </Grid>
                        <DataTemplate.Triggers>
                            <DataTrigger Binding="{Binding Status}" Value="Inactive">
                                <Setter TargetName="txtId" Property="Foreground" Value="Red"/>
                                <Setter TargetName="txtName" Property="Foreground" Value="Red"/>
                            </DataTrigger>
                        </DataTemplate.Triggers>
                    </DataTemplate>
                    
                    <conv:DateTimeToIsoConverter x:Key="dateToIso"/>
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Control.Resources>
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition />
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <!--<ColumnDefinition Width="130"/>-->
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>

        <TextBlock Text="Plan erstellen" FontSize="22" FontWeight="Thin" Foreground="#E1000000" Margin="50,-5,0,25" Grid.ColumnSpan="2"/>
        
        <GroupBox Margin="5,5,5,0" Padding="5" Grid.Column="2" Grid.Row="1" BorderThickness="0">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="200"/>
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                
                <TextBlock Text="Name"/>
                <TextBox Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1"/>
                
                <TextBlock Text="Monat" Grid.Row="1"/>
                <ComboBox Grid.Row="1" Grid.Column="1"
                          ItemsSource="{Binding MonthList}"
                          SelectedItem="{Binding SelectedMonth}"/>
                
                <TextBlock Text="Von" Grid.Row="2"/>
                <!--<DatePicker Grid.Row="2" Grid.Column="1"/>-->
                <TextBox Text="{Binding SelectedMonth.Von, Converter={StaticResource dateToIso}}" IsReadOnly="True" Focusable="False" Grid.Row="2" Grid.Column="1"/>

                <TextBlock Text="Bis" Grid.Row="3"/>
                <!--<DatePicker Grid.Row="3" Grid.Column="1"/>-->
                <TextBox Text="{Binding SelectedMonth.Bis, Converter={StaticResource dateToIso}}" IsReadOnly="True" Focusable="False"  Grid.Row="3" Grid.Column="1"/>

                <!--<TextBlock Text="{x:Static p:Resources.Layout}" Grid.Row="4"/>-->
                <TextBlock Text="{x:Static p:Resources.BasierendAufLayout}" Grid.Row="4"/>
                <ComboBox Grid.Row="4" Grid.Column="1"
                          ItemsSource="{Binding PlanLayouts}"
                          SelectedItem="{Binding SelectedLayout}"/>
                
                <TextBlock Text="{x:Static p:Resources.UseSpecificLayout}" Grid.Row="5"/>
                <StackPanel Grid.Row="5" Grid.Column="1" Orientation="Horizontal">
                    <CheckBox IsChecked="{Binding IsSpecificSchema}" VerticalAlignment="Center"/>
                    <Image Source="/personalplaner.gui;component/resources/images/Info.png" Grid.Column="2" Grid.Row="0" Margin="5,2,0,2" Height="16" ToolTip="{x:Static p:Resources.UseSpecificPlanLayoutToolTip}"/>
                </StackPanel>

            </Grid>
        </GroupBox>

        <StackPanel Grid.Row="2" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,20,40,20">
            <Button MinWidth="60" Margin="5" IsDefault="True" 
                    Command="{Binding OkCommand}">
                <TextBlock Text="OK"/>
            </Button>
            <Button MinWidth="60" Margin="5" IsCancel="True" 
                    Command="{Binding CancelCommand}">
                <TextBlock Text="Abbrechen"/>
            </Button>
        </StackPanel>
        
    </Grid>
</c:WindowExt>
